<?xml version="1.0" encoding="UTF-8"?>
<beans xmlns="http://www.springframework.org/schema/beans"
    xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
    xmlns:context="http://www.springframework.org/schema/context"
    xsi:schemaLocation="http://www.springframework.org/schema/beans 
                           http://www.springframework.org/schema/beans/spring-beans.xsd
                           http://www.springframework.org/schema/context 
                           http://www.springframework.org/schema/context/spring-context.xsd">
	
	<!-- Define the controllers using annotations -->
    <bean class="org.springframework.web.servlet.mvc.annotation.DefaultAnnotationHandlerMapping"/>
    <bean class="org.springframework.web.servlet.mvc.annotation.AnnotationMethodHandlerAdapter"/>
	<context:component-scan base-package="ctrl"/>
	
	<!-- ******************* -->
	<!-- DB and Hibernate    -->
	<!-- ******************* -->

	<bean class="start.Startup" id="init" init-method="initDB">
		<property name="driverClass" value="com.mysql.jdbc.Driver" />
		<property name="user" value="root" />
		<property name="password" value="" />
		<property name="defaultDBurl" value="jdbc:mysql://localhost:3306/mysql" />
		<property name="newDB" value="baywaldtours" />
    </bean>
	
	<bean id="dataSource"
		class="com.mchange.v2.c3p0.ComboPooledDataSource"
		destroy-method="close"
		depends-on="init">
		<property name="driverClass" value="com.mysql.jdbc.Driver" />
		<property name="jdbcUrl" value="jdbc:mysql://localhost/baywaldtours" />
		<property name="user" value="root" />
		<property name="password" value="" />
		<property name="minPoolSize" value="2" />
      	<property name="maxPoolSize" value="4" />
	</bean>
	
	<import resource="applicationContextSecurity.xml"/>
	
	<import resource="applicationContextDataAccess.xml"/>
	
	<!-- ******************* -->
	<!-- Controllers         -->
	<!-- ******************* -->
	  
 	<bean id="routeCtrl" class="ctrl.RouteCtrl">
		<property name="routeDao" ref="routeDao" />
		<property name="orteDao" ref="orteDao" />
		<property name="regionDao" ref="regionDao"/>
		<property name="bewertungDao" ref="bewertungDao"></property>
		<property name="bilderDao" ref="bilderDao"></property>
	</bean>
	
	<bean id="regionCtrl" class="ctrl.RegionCtrl">
		<property name="regionDao" ref="regionDao" />
	</bean>
	
	<bean id="orteCtrl" class="ctrl.OrteCtrl">
		<property name="orteDao" ref="orteDao" />
		<property name="regionDao" ref="regionDao" />
		<property name="routeDao" ref="routeDao" />
	</bean>
	
	
	
	<!-- ******************* -->
	<!-- Views               -->
    <!-- ******************* -->
	
	<bean id="viewResolver" class="org.springframework.web.servlet.view.InternalResourceViewResolver">
		<property name="prefix" value="/view/" />
		<property name="suffix" value=".jsp" />
	</bean>
	
</beans>